package com.day0909;

import java.util.Scanner;

public class Text4 {
    public static void main(String[] args) {
        //        循环录入某学生5门课的成绩并计算平均分，
//        如果某分数录入为负，停止录入并提示录入错误
        Scanner in =new Scanner(System.in);
        int score;
        int sum = 0;
        boolean flag = true;
        for(int i = 1; i < 6; i ++){
            System.out.print("第" + i + "名学生的成绩为：");
            score = in.nextInt();
            if(score > 100 || score < 0){
                System.out.println("成绩录入错误！");
                flag = true;
                break;
            }
            sum += score;
        }
        if(flag){
            System.out.println("总分：" + sum);
            System.out.println("平均分：" + sum / 5);
        }

    }
}
